//
//  MyHeaderView.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/10/18.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "MyHeaderView.h"
#import "JTCSM.h"
@implementation MyHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (id)init{
    self = [super init];
    if (self) {
        
        self.phoneLabel = [UILabel initWithFrame:CGRectMake(0, 40, KSCREENWidth, 30) text:@"13354280395" font:25 textAlignment:NSTextAlignmentCenter texcolor:[UIColor whiteColor] backgroundColor:nil];
        [self addSubview:self.phoneLabel];
        
        
        self.oneView = [[MyDoubleLabelView alloc]initWithFrame:CGRectMake(0, KVIEW_Y(self.phoneLabel)+30, (KSCREENWidth-1)/2, 0) titleFontsize:14 titlecolor:[UIColor whiteColor] contentFontsize:23 contentcolor:[UIColor whiteColor]];
        [self.oneView setvalueWithModel:nil];
        [self addSubview:self.oneView];
        
        UIView *line = [[UIView alloc]initWithFrame:CGRectMake((KSCREENWidth-1)/2, self.oneView.frame.origin.y, 1, self.oneView.frame.size.height)];
        line.backgroundColor = [UIColor whiteColor];
        [self addSubview:line];
        
        self.twoView = [[MyDoubleLabelView alloc]initWithFrame:CGRectMake((KSCREENWidth)/2+0.5, KVIEW_Y(self.phoneLabel)+30, (KSCREENWidth-1)/2, 0) titleFontsize:14 titlecolor:[UIColor whiteColor] contentFontsize:23 contentcolor:[UIColor whiteColor]];
        [self.twoView setvalueWithModel:nil];
        [self addSubview:self.twoView];
        
        self.frame = CGRectMake(0, 0, KSCREENWidth, KVIEW_Y(self.twoView)+20);
        self.backgroundColor = RGBACOLOR(227, 68, 40, 1);
        
    }
    
    return self;
}

- (void)setvalueWithUserInfoModel:(UserInfoModel *)model{
    if (model == nil) {
        return;
    }
    self.phoneLabel.text = [model.account stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
    [self.oneView setvalueWithModel:@{KDoubleLabelTitle:@"账户余额",KDoubleLabelContent:model.money==nil?@"":model.money}];
    [self.twoView setvalueWithModel:@{KDoubleLabelTitle:@"冻结资金",KDoubleLabelContent:model.frozen_money==nil?@"":model.frozen_money}];

    
}

@end
